cmake_minimum_required(VERSION 3.10.0)

# 项目信息
project(myApp VERSION 1.0.0 LANGUAGES C CXX)

# 设置 C 和 C++ 标准
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED TRUE)
set(CMAKE_C_EXTENSIONS OFF)  # 确保使用 -std=c11 而非 -std=gnu11

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CXX_EXTENSIONS OFF)  # 确保使用 -std=c++11 而非 -std=gnu++11

# 查找 C 和 C++ 源文件
file(GLOB C_SRC_FILES "${PROJECT_SOURCE_DIR}/src/*.c")
file(GLOB CXX_SRC_FILES "${PROJECT_SOURCE_DIR}/src/*.cpp")

# 设置可执行文件
add_executable(${PROJECT_NAME} ${C_SRC_FILES} ${CXX_SRC_FILES})

# 添加头文件目录
target_include_directories(${PROJECT_NAME} PRIVATE "${PROJECT_SOURCE_DIR}/inc")

# 显示包含的源文件（可选，用于调试）
message(STATUS "C Source files: ${C_SRC_FILES}")
message(STATUS "C++ Source files: ${CXX_SRC_FILES}")
